package com.game.mongo;

import com.mongodb.Mongo;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.core.MongoTemplate;

import java.util.Optional;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * Created by legend9999 on 2016/6/5.
 */
@Configuration
public class MongoConfig {
    public @Bean Mongo mongo() throws Exception {
        return new Mongo();
    }

    public @Bean MongoTemplate mongoTemplate() throws Exception {
        return new MongoTemplate(mongo(), "game");
    }
    @Bean(name="blockingQueue")
    public BlockingQueue<Runnable> getBlockingQueue(){
        return new LinkedBlockingQueue<Runnable>();
    }
}
